<?
$c = new ModuleConfig("event");

// -- Controller --

$c->setControllerConfig(
    new ControllerConfig(
        array(
            "nocache"=>"true",
            "contentType"=>"text/xml",
            "forwardPattern"=>"cms/\$M/view\$P",
            "locale"=>"true"
        )
    )
);

// -- Helpers --

$c->addHelperPath("cms/event/helper", "PHP_CMS_View_Helper_");


// -- MessageResources --

$c->addMessageResourcesConfig(
    new MessageResourcesConfig(
        array(
            "parameter"=>"cms/event/resource/MessageResources",
            "key"=>"php-cms-event",
            "nullValue"=>false
        )
    )
);

// -- FormBeans --

$c->addFormBeanConfig(
    new FormBeanConfig(
        array(
            "name"=>"eventForm",
            "type"=>"cms/event/action/EventForm"
        )
    )
);
$c->addFormBeanConfig(
    new FormBeanConfig(
        array(
            "name"=>"eventListForm",
            "type"=>"cms/event/action/ListForm"
        )
    )
);

// -- Global Exceptions --

$c->addExceptionConfig(
    new ExceptionConfig(
        array(
            "type"=>"Exception",
            "path"=>"cms/core/view/error/exception.php",
            "handler"=>"mvc/action/ExceptionHandler"
        )
    )
);
$c->addExceptionConfig(
    new ExceptionConfig(
        array(
            "type"=>"AccessDeniedException",
            "path"=>"cms/core/view/error/forbidden.php",
            "handler"=>"mvc/action/ExceptionHandler"
        )
    )
);


// -- Action Mappings --

$c->addActionConfig(
    new ActionConfig(
        array(
            "path"=>"/unknown",
            "unknown"=>true,
            "type"=>"cms/core/action/error/UnknownAction"
            ,
            "forwards"=>array(
                "success"=>new ForwardConfig(
                    array(
                        "name"=>"success",
                        "path"=>"cms/core/view/error/notfound.php",
                        "redirect"=>false
                    )
                )
            )            
        )
    )
);
$c->addActionConfig(
    new ActionConfig(
        array(
            "path"=>"/list",
            "validate"=>true,
            "name"=>"eventListForm",
            "attribute"=>"cms/eventListForm",
            "input"=>"/index.php",
            "scope"=>"session",
            "type"=>"cms/event/action/ListAction"
            ,
            "forwards"=>array(
                "success"=>new ForwardConfig(
                    array(
                        "name"=>"success",
                        "path"=>"/index.php",
                        "redirect"=>false
                    )
                )
            )            
        )
    )
);
$c->addActionConfig(
    new ActionConfig(
        array(
            "path"=>"/edit",
            "validate"=>false,
            "name"=>"eventForm",
            "scope"=>"request",
            "type"=>"cms/event/action/EditAction"
            ,
            "forwards"=>array(
                "success"=>new ForwardConfig(
                    array(
                        "name"=>"success",
                        "path"=>"/edit.php",
                        "redirect"=>false
                    )
                )
            )            
        )
    )
);
$c->addActionConfig(
    new ActionConfig(
        array(
            "path"=>"/save",
            "validate"=>true,
            "name"=>"eventForm",
            "input"=>"/edit.php",
            "scope"=>"request",
            "type"=>"cms/event/action/SaveAction"
            ,
            "forwards"=>array(
                "success"=>new ForwardConfig(
                    array(
                        "name"=>"success",
                        "path"=>"/list?save=ok",
                        "redirect"=>true
                    )
                )
            )            
        )
    )
);

return $c;
?>